//
//  HomePageSecondViewController.m
//  App-MyFairldy
//
//  Created by dlios on 15-5-26.
//  Copyright (c) 2015年 客官大大. All rights reserved.
//

#import "HomePageSecondViewController.h"

@interface HomePageSecondViewController ()

@end

@implementation HomePageSecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIScrollView *myScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 50)];
    myScrollView.backgroundColor = [UIColor redColor];
    myScrollView.contentSize = CGSizeMake(self.view.frame.size.width * 5, 0);
    [myScrollView setContentOffset:CGPointMake(0, 0)];
    myScrollView.pagingEnabled = YES;
    myScrollView.delegate = self;
    [self.view addSubview:myScrollView];
    
    for (int i = 0; i < 5; i++) {
        UIImageView *myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i, 0, myScrollView.frame.size.width, myScrollView.frame.size.height - 300)];
        myImageView.backgroundColor = [UIColor yellowColor];
        [myScrollView addSubview:myImageView];
        
        UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i, myScrollView.frame.origin.y + 300, myScrollView.frame.size.width, 300)];
        myLabel.backgroundColor = [UIColor greenColor];
        [myScrollView addSubview:myLabel];
        
        [myImageView release];
        [myLabel release];
    }
    
    
}



- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    NSLog(@"%f", scrollView.contentOffset.x);
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
